const express = require('express')
const app = express()
const bodyParser = require('body-parser')
const session = require('express-session')

const static_path = {universal: 'front-end',elm: 'front-end-elm'}

app.use(bodyParser.urlencoded({ extended: true }))
app.use(bodyParser.json())
app.use(express.static(static_path.elm))
app.use(session({ secret: 'A shit app', cookie: { maxAge: 1800000 }}))

//挂载路由
require('./routes/do_route')(app)

//初始化内存数据库
require('./models/mock_db').init()

const port = 3456
app.listen(port)
console.log('server started on: ' + port)